package com.qf.utils;

import com.alibaba.druid.pool.DruidDataSourceFactory;
import org.apache.commons.dbutils.QueryRunner;

import javax.sql.DataSource;
import java.io.InputStream;
import java.util.Properties;

public enum DBUtils {
    DB;
    public QueryRunner  qr;
    DBUtils(){
        try {
            InputStream is = DBUtils.class.getResourceAsStream("db.properties");
            Properties pro = new Properties();
            pro.load(is);
            DataSource  ds = DruidDataSourceFactory.createDataSource(pro);
            qr = new QueryRunner(ds);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}